package com.softer.wxzj.controller;

import com.softer.wxzj.common.aop.annotation.LogRecord;
import com.softer.wxzj.common.aop.enums.LogOperationType;
import com.softer.wxzj.common.aop.enums.LogOperationUnit;
import com.softer.wxzj.entity.BaseBuildView;
import com.softer.wxzj.service.BaseBuildViewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @description:结构视图
 * @ClassName: BaseHouseInfoController
 * @author: zcz
 * @date: 2019-05-20 16:31
 */
@RestController
@RequestMapping("/BaseBuildView")
@Slf4j
public class BaseBuildViewController {
    @Autowired
    BaseBuildViewService baseBuildViewService;

    @RequestMapping("/getView")
    @LogRecord(description = "查询楼栋结构视图", operationUnit = LogOperationUnit.BASE_BUILD_VIEW, operationType = LogOperationType.SELECT)
    public BaseBuildView getView(@RequestParam("buildNo") String buildNo) {
        return baseBuildViewService.getView(buildNo);
    }

    @RequestMapping("/getHouseCountByStateOrDueState")
    @LogRecord(description = "查询房屋数量", operationUnit = LogOperationUnit.BASE_BUILD_VIEW, operationType = LogOperationType.SELECT)
    public Map<String, Long> getHouseCountByStateOrDueState(String state, String dueState) {
        return baseBuildViewService.getHouseCountByStateOrDueState(state, dueState);
    }

    @RequestMapping("/getViewHead")
    @LogRecord(description = "查询视图页面头部", operationUnit = LogOperationUnit.BASE_BUILD_VIEW, operationType = LogOperationType.SELECT)
    public Map<String, Object> getViewHead(@RequestParam("regionNo") String regionNo) {
        return baseBuildViewService.getViewHead(regionNo);
    }

    @RequestMapping("/getHouseCount")
    @LogRecord(description = "查询视图页面各状态房屋数量", operationUnit = LogOperationUnit.BASE_BUILD_VIEW, operationType = LogOperationType.SELECT)
    public Map<String, Object> getHouseCount(@RequestParam("buildNo") String buildNo) {
        return baseBuildViewService.getHouseCount(buildNo);
    }

    @RequestMapping("/getHouseInfoDetail")
    @LogRecord(description = "视图模块房间维护详情界面", operationUnit = LogOperationUnit.BASE_BUILD_VIEW, operationType = LogOperationType.SELECT)
    public Map<String, Object> getHouseInfoDetail(@RequestParam("houseId") String houseId, String arcType) {
        return baseBuildViewService.getHouseInfoDetail(houseId, arcType);
    }
}
